import  cv2 as cv
import math
import numpy as np
np.set_printoptions(threshold=np.inf)

def ColourDistance(rgb_1, rgb_2):
    R_1, G_1, B_1 = rgb_1
    R_2, G_2, B_2 = rgb_2
    rmean = (R_1 + R_2) / 2
    R = R_1 - R_2
    G = G_1 - G_2
    B = B_1 - B_2
    return math.sqrt((2 + rmean / 256) * (R ** 2) + 4 * (G ** 2) + (2 + (255 - rmean) / 256) * (B ** 2))


def get_color():
    draw=cv.imread("draw.png")

    draw_mask=cv.imread("vease.jpg")
    img_num=[ ]
    img_nums=[]
    img_arr=[]
    # for i in range(draw.shape[0]):
    #     item=[]
    #     for j in range(draw.shape[1]):
    #         zhi=draw[i][j][0]*1000000+draw[i][j][0]*1000+draw[i][j][2]
    #         item.append(zhi)
    #         img_arr.append(item[j])
    #     img_num.append(item)
    # img_set=set(img_arr)
    # str_img_arr=str(img_arr)
    # print(str_img_arr)
    #
    # img_counts=str_img_arr.count("255255255")
    # sort1=list(img_set)
    # # print(sorted(sort1))
    # print(img_counts)
    # #print(img_num)

    print("1",draw_mask.shape)
    #ret,draw_mask=cv.threshold(draw_mask, 10, 225, cv.THRESH_BINARY)
    print(draw_mask.shape)
    img2 = cv.bitwise_and(draw, draw, mask=draw_mask)




    cv.imshow("abc",img2)
    cv.waitKey(0)




if __name__ == '__main__':
    a=[47,79,79]
    b=[154,117,167]
    c=[229,229,229]
    d=[219,220,220]

    a=ColourDistance(c,d)
    get_color()
    print(a)
    print("")


